<template>
  <div>
		<BreadCrumb />
		<StudentList v-if="active === 0" @dbclick="dbClick" />
		<div v-else>
			<el-button @click="active = 0" style="margin-bottom: 10px;">返回</el-button>
			<QuestionRecords :tableData="questionRecords" :activeName="activeName" />
		</div>		
  </div>
</template>

<script setup>
import BreadCrumb from '@@/menu/breadcrumb'
import StudentList from '@@/homework/studentList'
import QuestionRecords from '@@/question/records'
import { ref } from 'vue'
import { get } from '@/axios'
import { ElMessage } from 'element-plus'
const active = ref(0)
const questionRecords = ref([])
const activeName = ref('')
function dbClick (row) {
	getQuestionRecords(row.id)
}

function getQuestionRecords (userId) {
	get('/userAnswer/getAnwserByUserId', { userId }, content => {
		if (content.length === 0) {
			ElMessage.error('无刷题数据')
			return
		}
		questionRecords.value = content
		activeName.value = JSON.stringify([0].id) 
		active.value = 1
	})
}
</script>

<style scoped lang="scss">
</style>